package com.ferryc.fegin;

import com.ferryc.entity.User;
import com.ferryc.fegin.hystrix.UserServiceFallbackFactory;
import com.ferryc.model.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by Ferry Chen on 2019/11/13.
 */

@FeignClient(name = "account-service",fallbackFactory = UserServiceFallbackFactory.class,path = "/user")
public interface UserFeignClient {

    @PostMapping("/add")
    public Result add(@RequestParam(value = "username") String username);

    @GetMapping("/list")
    public Result<List<User>> queryUser();
}
